home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9105 / ehrmann.may next >
Text File  |  1991-03-27  |  4KB  |  180 lines

  1.  
  2. LISTING 1.
  3.  
  4.  
  5.    ; ------------------------------------------------------------
  6.    ; Export Customer table to a text file
  7.    ;
  8.    ; This module steps through the Paradox menus to export a
  9.    ; table to an ASCII text file.  If the file already exists,
  10.    ; it will be replaced automatically.
  11.    ; ------------------------------------------------------------
  12.    Proc EXPORT_CUSTOMER()
  13.  
  14.       message "Exporting Customer Table to CUSTREP.TXT"
  15.  
  16.       Menu
  17.          {Tools} {ExportImport} {Export} {ASCII} {Delimited}
  18.          select "CUSTOMER"
  19.          select "CUSTREP.TXT"
  20.  
  21.       If MenuChoice() = "Cancel" then
  22.          {Replace}
  23.       EndIf
  24.  
  25.       Return
  26.  
  27.    EndProc
  28.  
  29.  
  30.  
  31. LISTING 2.
  32.  
  33.  
  34.    ; ------------------------------------------------------------
  35.    ; Export Customer table to a text file
  36.    ; ------------------------------------------------------------
  37.    Proc EXPORT_CUSTOMER()
  38.  
  39.       message "Exporting Customer Table to CUSTREP.TXT"
  40.  
  41.       Menu
  42.          {Tools} {ExportImport} {Export} {ASCII} {Delimited}
  43.          select "CUSTOMER"
  44.          select "CUSTREP.TXT"
  45.  
  46.       If MenuChoice() = "Cancel" then
  47.          {Replace}
  48.       EndIf
  49.  
  50.       Return
  51.  
  52.    EndProc
  53.  
  54.    ; here is where the proc is actually invoked!
  55.  
  56.    EXPORT_CUSTOMER()
  57.  
  58.  
  59.  
  60. LISTING 3.  
  61.  
  62.  
  63.    ; ------------------------------------------------------------
  64.    ; Export Customer table to a text file
  65.    ; ------------------------------------------------------------
  66.    Proc EXPORT_CUSTOMER()
  67.       Private X                 ; holding variable for file extension
  68.  
  69.       X = ".TXT"                ; assign value to the variable
  70.  
  71.       message "Exporting Customer Table to CUSTREP" + X
  72.  
  73.       Menu
  74.          {Tools} {ExportImport} {Export} {ASCII} {Delimited}
  75.          select "CUSTOMER"
  76.          select "CUSTREP" + X
  77.  
  78.       If MenuChoice() = "Cancel" then
  79.          {Replace}
  80.       EndIf
  81.  
  82.       Return
  83.  
  84.    EndProc
  85.  
  86.  
  87.  
  88. LISTING 4.  
  89.  
  90.  
  91.    ; ------------------------------------------------------------
  92.    ; Export Customer table to a text file
  93.    ; ------------------------------------------------------------
  94.    Proc EXPORT_TABLE ( TABLE.TO.EXPORT,    ; table being exported
  95.                        DESTINATION.FILE,   ; file to export to
  96.                        EXPORT.DESCRIPTION  ; description of export
  97.                      )
  98.  
  99.       message "Exporting the " + EXPORT.DESCRIPTION + " Table"
  100.  
  101.       Menu {Tools} {ExportImport} {Export} {ASCII}
  102.          Select TABLE.TO.EXPORT
  103.          Select DESTINATION.FILE
  104.  
  105.       If MenuChoice() = "Cancel" then
  106.          {Replace}
  107.       EndIf
  108.  
  109.       Return
  110.  
  111.    EndProc
  112.  
  113.  
  114.  
  115.  
  116. LISTING 5
  117.  
  118.  
  119.    ; ------------------------------------------------------------
  120.    ; Send a standard message to the user
  121.    ; ------------------------------------------------------------
  122.    proc USER_MESSAGE ( MESSAGE.TEXT ,     ; text to display
  123.                        MESSAGE.COLOR ,    ; "R"=Regular  "E"=Error
  124.                        DO.KEYPRESS        ; pause for a keypress ?
  125.                      )
  126.  
  127.       ; set color to use for writing the message
  128.       ; once we test MESSAGE.COLOR as passed into the proc,
  129.       ; we don't need it again.  So we reuse it for the actual color
  130.  
  131.       if MESSAGE.COLOR = "E" then
  132.          MESSAGE.COLOR = syscolor(3)      ; use Pdox error color
  133.       else
  134.          MESSAGE.COLOR = syscolor(0)      ; use Pdox regular color
  135.       endif
  136.  
  137.       ; paint top two lines of screen
  138.  
  139.       paintcanvas fill " "
  140.                   attribute MESSAGE.COLOR
  141.                   0, 0, 1, 79
  142.       style attribute MESSAGE.COLOR
  143.  
  144.       ; do we need to pause.
  145.  
  146.       if DO.KEYPRESS = True then
  147.  
  148.          ; on which line do we write the keypress message
  149.  
  150.          if len(MESSAGE.TEXT) < 65 then
  151.             @ 0,0 ?? MESSAGE.TEXT + ".  Press a key."
  152.          else
  153.             @ 0,0 ?? MESSAGE.TEXT + "."
  154.             @ 1,0 ?? "Press a key to continue."
  155.          endif
  156.  
  157.          ; pause for a keypress; clean up
  158.  
  159.          retval = getchar()
  160.          paintcanvas fill " "
  161.                      attribute syscolor(0)
  162.                      0, 0, 1, 79
  163.          style
  164.  
  165.          ; return the key pressed - we can trap for special keys
  166.  
  167.          return retval
  168.       else
  169.  
  170.          ; no pause; paint message and continue
  171.  
  172.          @ 0,0 ?? MESSAGE.TEXT
  173.          style
  174.          return False
  175.  
  176.       endif
  177.  
  178.    endproc
  179.  
  180.